package com.liuyjy.coffee;

/**
 * @Author liuyjy
 * @Date 2025/2/19 12:58
 * @Description: 装饰器模式在不改变原始类的基础上，动态扩展其功能。
 * 咖啡加料模拟一个咖啡订单系统，可以动态加料
 **/

public class MilkDecorator implements Coffee {
    private Coffee coffee;

    public MilkDecorator(Coffee coffee) {
        this.coffee = coffee;
    }

    @Override
    public String getDescription() {
        return coffee.getDescription() + ", Milk";
    }

    @Override
    public double getCost() {
        return coffee.getCost() + 1.5;
    }
}
